Skip to content

fix(service): RED-2 — honor the advertised local_only authority_boundary on read paths#6

Merged
tachyon-beep merged 2 commits into
mainfrom
fix/red2-authority-boundary
Jun 29, 2026
Merged

fix(service): RED-2 — honor the advertised local_only authority_boundary on read paths#6
tachyon-beep merged 2 commits into
mainfrom
fix/red2-authority-boundary

Conversation

@tachyon-beep

Copy link
Copy Markdown
Contributor

Closes the RED-2 authority-boundary honesty-invariant violation (hub ticket weft-d5091cba12): read tools advertise authority_boundary {local_only: true, live_peer_calls: false}, but the trace-enrich path called the HTTP-capable resolve_identity, making a live Loomweave call whenever an endpoint was configured — falsifying the advertised boundary (the code even self-contradicted with a "configured but was not called" note).

Fix (option a — honor the boundary): service.py:2488 resolve_identity(lookup)resolve_identity_local(lookup). The read-time enrich path needs only content_hash/drift/orphan, all available from the local sqlite catalog, so honoring breaks nothing — it just makes the advertisement true. The bar for the alternative (correct the advertisement) wasn't met.

Correct nuance: the mutating _normalize_trace_refs path (create/accept-trace) is deliberately LEFT on live resolution — it does not advertise local_only.

Tests: make ci green (380 passed, 91.18% cov ≥ 90); wardline scan exit 0. Two anti-vacuous regression tests added (endpoint configured → no live call on the advertised-local read path + the dossier tool).

Release mode: no cross-member contract change — aligns behavior to the EXISTING advertised contract. Ships solo.

🤖 Generated with Claude Code

tachyon-beep and others added 2 commits June 28, 2026 21:44
…RED-2)

Plainweave's read tools advertise `local_only: True` /
`live_peer_calls: False`, but the read-time enrich path
`_enrich_loomweave_trace` called the HTTP-capable
`LoomweaveAdapter.resolve_identity`, which routes to the live identity
endpoint whenever a Loomweave URL is configured (WEFT_LOOMWEAVE_URL or
.weft/loomweave/ephemeral.port). So `plainweave_trace_link_list`, the
requirement dossier, and verification status made a LIVE peer call while
advertising they do not — and the dossier's own note ("endpoint
configured but was not called") was false. Honesty-invariant violation.

Fix (option a — honor the boundary): route `_enrich_loomweave_trace`
through `resolve_identity_local`, which resolves from the local Loomweave
catalog only and never makes a live peer call. Local resolution already
supplies everything enrich needs (content_hash, drift, orphan detection),
as the existing read-time-drift/orphan tests prove by mutating the local
DB and reading back. The advertised boundary is now true, and the dossier
note is honest.

Write-time normalization (`_normalize_trace_refs`, reached only from the
mutating create/accept trace ops, which do not advertise local_only) is
deliberately left on the HTTP-capable resolver.

Regression tests (both fail on the unfixed code):
- tests/state/test_trace_links.py: with an endpoint configured, `trace_for`
  enrich makes no live peer call (`_http_json` patched to raise).
- tests/test_mcp_read_surface.py: with an endpoint configured, the dossier
  tool reports `live_peer_calls=False` and makes no live peer call.

Refs: weft-d5091cba12

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fc94e6d72f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/plainweave/service.py
# true even when a Loomweave endpoint is configured (RED-2,
# weft-d5091cba12). Write-time normalization (``_normalize_trace_refs``)
# is a separate, non-local_only path and keeps live resolution.
current = self._loomweave_adapter().resolve_identity_local(lookup)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve live accept results on mutation responses

This helper is also used by _transition_trace() after accept_trace_link(): that path deliberately calls the HTTP-capable _normalize_trace_refs(), writes the live Loomweave snapshot, and then returns _trace_from_row(). When WEFT_LOOMWEAVE_URL is configured but the local Loomweave catalog is missing or behind the remote SEI data, this local-only re-resolution replaces the freshly accepted response with freshness="unknown"/identity_unsupported (or stale) even though the row was just accepted with a current live snapshot; the CLI/web accept response can therefore report a degraded trace immediately after a successful live-resolution mutation.

Useful? React with 👍 / 👎.

@tachyon-beep tachyon-beep merged commit 9b5fc88 into main Jun 29, 2026
1 check passed
@tachyon-beep tachyon-beep deleted the fix/red2-authority-boundary branch June 29, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant